<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>软件及设备信息</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../../../../css/mui.min.css">
		<link rel="stylesheet" href="../../../../css/global.css">
		<link rel="stylesheet" href="../../../../css/style.css">
		<link rel="stylesheet" href="../../../../css/mui.picker.css">
		<link rel="stylesheet" href="../../../../css/mui.poppicker.css">
		<style>
			button:disabled {
				opacity: 1;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a onclick="cancelBtn()" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">软件及设备信息</h1>
		</header>
		<div class="mui-content">
			<div class="details_con">
				<div hidden>
					<input type="hidden" id="ServiceNoticeId" />
					<input type="hidden" id="serviceNoV" />
				</div>
				<div class="clum">
					<span class="name">服务编号</span>
					<span id="serviceNo" class="txt"></span>
				</div>
				<div class="clum">
					<span class="name">设备类型1</span>
					<input type="text" id="equipmentType1" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">序列号1</span>
					<input type="text" id="serialNumber1" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">设备类型2</span>
					<input type="text" id="equipmentType2" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">序列号2</span>
					<input type="text" id="serialNumber2" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">设备类型3</span>
					<input type="text" id="equipmentType3" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">序列号3</span>
					<input type="text" id="serialNumber3" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">电脑厂家</span>
					<input type="text" id="computerMfr" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">服务号</span>
					<input type="text" id="serviceNumber" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">电脑型号</span>
					<input type="text" id="modelNumber" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">系统软件</span>
					<input type="text" id="systemSoftware" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">操作软件</span>
					<input type="text" id="software" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="clum">
					<span class="name">选项软件</span>
					<input type="text" id="optionSoftware" class="d_ipt" value=""  placeholder="请输入"/>
				</div>
				<div class="line"></div>
				<div class="btn_box">
					
					<span id="cancel" class="fl">取消</span>
					<span id="saveBtn" class="fr red">保存</span>
				</div>
				<div style="height: 50px;"></div>
			</div>
		</div>

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../../js/mui.min.js"></script>
		<script src="../../../../js/utils/h.js"></script>
		<script src="../../../../js/constant.js"></script>
		<script src="../../../../js/common.js"></script>
		<script src="../../../../js/utils/base64.js"></script>
		<script src="../../../../js/utils/md5.js"></script>
		<script src="../../../../js/utils/sortMap.js"></script>
		<script src="../../../../js/utils/http.js"></script>
		<script src="../../../../js/app.js"></script>
		<!-- 基础js end -->
		<script src="../../../../js/utils/rolldate.min.js"></script>
		<script src="../../../../js/mui.picker.js"></script>
		<script src="../../../../js/mui.poppicker.js"></script>
		<script type="text/javascript" charset="utf-8">
			var equipmentType1 = "";
			var serialNumber1 = "";
			var equipmentType2 = "";
			var serialNumber2 = "";
			var equipmentType3 = "";
			var serialNumber3 = "";
			var computerMfr = "";
			var modelNumber = "";
			var serviceNumber = "";
			var software = "";
			var optionSoftware = "";
			var systemSoftware = "";
			var id = "";
			var InstrumentCode;
			// 提交状态 0未提交 1已提交
			var submitStatus = 0;
			/*
			* 禁止交互事件
			*/
			function noInteraction() {
				if(submitStatus && submitStatus == '1') {
					h('#equipmentType1').attr('readonly', 'readonly')
					h('#serialNumber1').attr('readonly', 'readonly')
					h('#equipmentType2').attr('readonly', 'readonly')
					h('#serialNumber2').attr('readonly', 'readonly')
					h('#equipmentType3').attr('readonly', 'readonly')
					h('#serialNumber3').attr('readonly', 'readonly')
					h('#computerMfr').attr('readonly', 'readonly')
					h('#serviceNumber').attr('readonly', 'readonly')
					h('#modelNumber').attr('readonly', 'readonly')
					h('#systemSoftware').attr('readonly', 'readonly')
					h('#software').attr('readonly', 'readonly')
					h('#optionSoftware').attr('readonly', 'readonly')
					
					h('#saveBtn').hide()
					h('#cancel').hide()
				}
			}
			
			(function($, doc) {
				$.init();

				$.plusReady(function() {
					var self = plus.webview.currentWebview();
					// 获取上一个页面传过来的参数并显示到页面
					submitStatus = self.submitStatus;
					InstrumentCode = self.InstrumentCode;
					h('#serviceNo').html(self.serviceNo);
					h('#serviceNoV').val(self.serviceNo);
					h('#ServiceNoticeId').val(self.ServiceNoticeId);
					if(!JS.IsNullOrEmpty(self.iqrId)){
						id = self.iqrId;
					}
					
					equipmentType1 = self.equipmentType1;
					serialNumber1 = self.serialNumber1;
					equipmentType2 = self.equipmentType2;
					serialNumber2 = self.serialNumber2;
					equipmentType3 = self.equipmentType3;
					serialNumber3 = self.serialNumber3;
					computerMfr = self.computerMfr;
					modelNumber = self.modelNumber;
					serviceNumber = self.serviceNumber;
					software = self.software;
					optionSoftware = self.optionSoftware;
					systemSoftware = self.systemSoftware;
					
					h("#equipmentType1").val(equipmentType1);
					h("#serialNumber1").val(serialNumber1);
					h("#equipmentType2").val(equipmentType2);
					h("#serialNumber2").val(serialNumber2);
					h("#equipmentType3").val(equipmentType3);
					h("#serialNumber3").val(serialNumber3);
					h("#computerMfr").val(computerMfr);
					h("#modelNumber").val(modelNumber);
					h("#serviceNumber").val(serviceNumber);
					h("#software").val(software);
					h("#optionSoftware").val(optionSoftware);
					h("#systemSoftware").val(systemSoftware);
					
					
					noInteraction()
					// 数据初始化带入默认数据
					initData();
					
					// 保存方法 把参数传到上一个页面
					h("#saveBtn").tap(function(){
						var equipmentType1Save = h("#equipmentType1").val();
						var serialNumber1Save = h("#serialNumber1").val();
						var equipmentType2Save = h("#equipmentType2").val();
						var serialNumber2Save = h("#serialNumber2").val();
						var equipmentType3Save = h("#equipmentType3").val();
						var serialNumber3Save = h("#serialNumber3").val();
						var computerMfrSave = h("#computerMfr").val();
						var modelNumberSave = h("#modelNumber").val();
						var serviceNumberSave = h("#serviceNumber").val();
						var softwareSave = h("#software").val();
						var optionSoftwareSave = h("#optionSoftware").val();
						var systemSoftwareSave = h("#systemSoftware").val();
						// 查找需要跳转的页面，并指定刷新的方法
						var assignList = plus.webview.getWebviewById('view/service/report/installationquality/add.html');
						assignList.evalJS('childData("'+equipmentType1Save+'","'+serialNumber1Save+'","'+equipmentType2Save+'","'+serialNumber2Save+'","'+equipmentType3Save+'","'+serialNumber3Save+'","'+computerMfrSave+'","'+modelNumberSave+'","'+serviceNumberSave+'","'+softwareSave+'","'+optionSoftwareSave+'","'+systemSoftwareSave+'")')
						$.back()
					})
					
					// 取消方法
					h("#cancel").tap(function(){
						cancelBtn("cancel");
					});
				});
			}(mui, document));
			
			// 安装质量报告页面自动带入项数据查询
			function initData(){
				// 如果ID不为空，是修改
				if(id!=undefined && id!=""){
					// ajaxGet(BASE_URL + "cc/installation/quality/report/getInstallationQualityReport", {
					// 	"id": id
					// }, function(data) {
					// 	console.log(JSON.stringify(data))
					// 	if(data.code==200){
					// 		h("#equipmentType1").val(data.data.equipmentType1);
					// 		h("#serialNumber1").val(data.data.serialNumber1);
					// 		h("#equipmentType2").val(data.data.equipmentType2);
					// 		h("#serialNumber2").val(data.data.serialNumber2);
					// 		h("#equipmentType3").val(data.data.equipmentType3);
					// 		h("#serialNumber3").val(data.data.serialNumber3);
					// 		h("#computerMfr").val(data.data.computerMfr);
					// 		h("#modelNumber").val(data.data.modelNumber);
					// 		h("#serviceNumber").val(data.data.serviceNumber);
					// 		h("#software").val(data.data.software);
					// 		h("#optionSoftware").val(data.data.optionSoftware);
					// 		h("#systemSoftware").val(data.data.systemSoftware);
					// 	}
					// }, function(errorMsg) {
					// 	console.log(JSON.stringify(errorMsg))
					// });
				}
				// 否则是新增
				else{
					app.showWaiting()
					ajaxGet(BASE_URL + "cc/installation/quality/report/initSoftwareAndPartsData", {
						"serviceNo": h("#serviceNoV").val(),
						"instrumentCode": InstrumentCode
					}, function(data) {
						app.closeWaiting()
						if(data.code==200){
							/* if(computerMfr==undefined || computerMfr==''){
								h("#computerMfr").val(data.data[0].computerMfr);
							}
							if(modelNumber==undefined || modelNumber==''){
								h("#modelNumber").val(data.data[0].modelNumber);
							}
							if(serviceNumber==undefined || serviceNumber==''){
								h("#serviceNumber").val(data.data[0].serviceNumber);
							}
							if(software==undefined || software==''){
								h("#software").val(data.data[0].software);
							}
							if(optionSoftware==undefined || optionSoftware==''){
								h("#optionSoftware").val(data.data[0].optionSoftware);
							}
							if(systemSoftware==undefined || systemSoftware==''){
								h("#systemSoftware").val(data.data[0].systemSoftware);
							} */
							
							var self = plus.webview.currentWebview();
							equipmentType1 = data.data[0].equipment_type1 ? data.data[0].equipment_type1 : self.equipmentType1;
							serialNumber1 = data.data[0].serial_number1 ? data.data[0].serial_number1 : self.serialNumber1;
							equipmentType2 = data.data[0].equipment_type2 ? data.data[0].equipment_type2 : self.equipmentType2;
							serialNumber2 = data.data[0].serial_number2 ? data.data[0].serial_number2 : self.serialNumber2;
							equipmentType3 = data.data[0].equipment_type3 ? data.data[0].equipment_type3 : self.equipmentType3;
							serialNumber3 = data.data[0].serial_number3 ? data.data[0].serial_number3 : self.serialNumber3;
							computerMfr = data.data[0].computerMfr ? data.data[0].computerMfr : self.computerMfr;
							modelNumber = data.data[0].modelNumber ? data.data[0].modelNumber : self.modelNumber;
							serviceNumber = data.data[0].serviceNumber ? data.data[0].serviceNumber : self.serviceNumber;
							software = data.data[0].software ? data.data[0].software : self.software;
							optionSoftware = data.data[0].optionSoftware ? data.data[0].optionSoftware : self.optionSoftware;
							systemSoftware = data.data[0].systemSoftware ? data.data[0].systemSoftware : self.systemSoftware;
							
							h("#equipmentType1").val(equipmentType1);
							h("#serialNumber1").val(serialNumber1);
							h("#equipmentType2").val(equipmentType2);
							h("#serialNumber2").val(serialNumber2);
							h("#equipmentType3").val(equipmentType3);
							h("#serialNumber3").val(serialNumber3);
							
							h("#computerMfr").val(computerMfr);
							h("#modelNumber").val(modelNumber);
							h("#serviceNumber").val(serviceNumber);
							h("#software").val(software);
							h("#optionSoftware").val(optionSoftware);
							h("#systemSoftware").val(systemSoftware);							
						}
					}, function(errorMsg) {
						app.closeWaiting()
						console.log(JSON.stringify(errorMsg))
					});
				}
				
			}
			
			function cancelBtn(flag){
				// 查找需要跳转的页面，并指定刷新的方法
				var assignList = plus.webview.getWebviewById('view/service/report/installationquality/add.html');
				assignList.evalJS('childData("'+equipmentType1+'","'+serialNumber1+'","'+equipmentType2+'","'+serialNumber2+'","'+equipmentType3+'","'+serialNumber3+'","'+computerMfr+'","'+modelNumber+'","'+serviceNumber+'","'+software+'","'+optionSoftware+'","'+systemSoftware+'")')
				if(flag == "cancel"){
					mui.back();
				}	
			}
		</script>
		<!-- js代码 end -->
	</body>
</html>
